# 关于alert
import time

from selenium import webdriver
import os
driver = webdriver.Chrome()
file = "file:///" + os.path.abspath("e:\比特课件\selenium2html/alert.html")
driver.get(file)
driver.maximize_window()
driver.find_element_by_id("tooltip").click()
# 关闭弹窗
#得到操作弹窗的句柄
alert = driver.switch_to.alert
time.sleep(3)
alert.accept()
time.sleep(5)
driver.quit()